﻿using System;
using System.Collections.Generic;
using System.Text;
using HutongGames.PlayMaker;
using UnityEngine;

namespace AddOn
{
    [AddComponentMenu("PlayMaker/FsmDevice")]
    [Serializable, ExecuteInEditMode]
    public class FsmDevice : MonoBehaviour, INameable, IComparable, IBlock
	{
        public List<FsmUnit> units = new List<FsmUnit>();

        public string Name
        {
            get { return this.name; }
        }

        public int CompareTo(object obj)
        {
            throw new NotImplementedException();
        }

        void Start()
        {
            RebuildUnits();
        }

        public void RebuildUnits()
        {
            units.Clear();
            FsmUnit[] us = this.GetComponentsInChildren<FsmUnit>();
            units.AddRange(us);
        }

        [SerializeField]
        private Rect position = new Rect(0, 0, 100, 50);

        public Rect Position
        {
            get
            {
                return position;
            }
            set
            {
                position = value;
            }
        }
    }
}
